fix(tm2/amino): preserve nil_elements in genproto2#5569
Closed
D4ryl00 wants to merge 2 commits intognolang:masterfrom
Closed
fix(tm2/amino): preserve nil_elements in genproto2#5569D4ryl00 wants to merge 2 commits intognolang:masterfrom
D4ryl00 wants to merge 2 commits intognolang:masterfrom
Conversation
Signed-off-by: D4ryl00 <d4ryl00@gmail.com>
Collaborator
🛠 PR Checks SummaryAll Automated Checks passed. ✅ Manual Checks (for Reviewers):
Read More🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers. ✅ Automated Checks (for Contributors):🟢 Maintainers must be able to edit this pull request (more info) ☑️ Contributor Actions:
☑️ Reviewer Actions:
📚 Resources:Debug
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
jefft0
approved these changes
Apr 22, 2026
Contributor
jefft0
left a comment
There was a problem hiding this comment.
This PR has tests for the fix described in the description. CI checks pass. Ready for core devs to review. Urgent fix for the stability of the chain.
ajnavarro
approved these changes
Apr 22, 2026
Signed-off-by: D4ryl00 <d4ryl00@gmail.com>
Contributor
|
taking a look now |
Contributor
|
Added alt with more fixes: #5590 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix a genproto2 regression introduced by #5282
e8aac7575f(feat(amino): add genproto2).After regenerating
pb3_gen.gofrom master,gnolandconsensus started failing deterministically becausetypes.Commit.Precommitsusesamino:"nil_elements", and the generated genproto2 decoder did not preserve positionalnilentries in unpacked pointer lists.In the failing path:
ByteLengthentry for that validatorLastCommitthen failed block validation withwrong LastCommitRoot Cause
Marshal was already correct: for unpacked pointer lists with
amino:"nil_elements", genproto2 encodes anilelement as an emptyByteLengthvalue (0x00), matching the reflect codec.The bug was in generated unmarshal: it did not turn that empty entry back into
nil. Instead, it decoded it as a non-nilzero-value element.For
types.Commit.Precommits, that is consensus-critical because the list is positional. A missing precommit must remainnil; turning it into a zero-valueCommitSigmakes the reconstructed commit invalid, which is why the next proposal failed withwrong LastCommit.The fix makes generated unmarshal match the reflect codec again: empty entries decode to
nil, non-empty entries stay on the generated fast path, andanyDepthis preserved.Why This Fix
Commit.Precommitsis positional and usesamino:"nil_elements". Losingnilentries or changing their decode semantics is not just cosmetic; it changes the meaning of the commit.The final implementation keeps genproto2 behavior aligned with the reflect codec while preserving the generated fast path and existing depth-guard semantics.